<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Regional,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="sun.reflect.generics.tree.IntSignature"%>
<%@page import="com.ejoysoft.common.Format"%>
<%@ page import="java.util.List"%>
<%@ include file="../include/jsp/head.jsp"%>

<%
	if (!globa.userSession.hasRight("10050"))
		throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<%
	//初始化
	Regional task0 = null;
	Regional obj = new Regional(globa);
	//查询条件
	String tWhere = " WHERE 1=1";
	tWhere += " ORDER BY strtaskid";

	//记录总数
	int intAllCount = obj.getCount(tWhere);
	//当前页
	int intCurPage = globa.getIntCurPage();
	//每页记录数
	String strPageSize = "10";
	int intPageSize;
	if (strPageSize.equals("所有"))
		intPageSize = intAllCount;
	else
		intPageSize = Integer.parseInt(strPageSize);
	//共有页数
	int intPageCount = (intAllCount - 1) / intPageSize + 1;
	// 循环显示一页内的记录 开始序号
	int intStartNum = (intCurPage - 1) * intPageSize + 1;
	//结束序号
	int intEndNum = intCurPage * intPageSize;
	//获取到当前页面的记录集
	Vector<Regional> vctObj = obj.list(tWhere, intStartNum, intPageSize);
	//获取当前页的记录条数
	int intVct = (vctObj != null && vctObj.size() > 0 ? vctObj.size()
			: 0);
	System.out.println("输出记录集的个数："+intVct);
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'regional_coverage.jsp' starting page</title>
    <style type="text/css">
	body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
	#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
	#r-result{height:100%;width:20%;float:left;}
	</style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="../css/main.css" rel="stylesheet" type="text/css" />
	<script language="JavaScript" src="../include/date/popc.js"></script>
	<script src="../include/js/list.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
	var image2 = new BMap.Icon('../images/jxwd.jpg', new BMap.Size(40, 50), {
	offset: new BMap.Size(10, 25), // 指定定位位置
	imageOffset: new BMap.Size(0, 0 ) // 设置图片偏移
	});
	var map;
	function  init(){
		map = new BMap.Map("allmap");
		map.addControl(new BMap.NavigationControl());//鼠标平移缩放控件
		map.addControl(new BMap.OverviewMapControl());//右下角可视控件
		map.addControl(new BMap.MapTypeControl()); //地图类型控件
		map.enableScrollWheelZoom();// 启用滚轮放大缩小	
		var point = new BMap.Point(117.2, 35.2);//创建坐标点的位置
		map.centerAndZoom(point, 5);
	}


	function show(){
	var markers = [];
	<%if (vctObj != null) {
		//System.out.println("vctObj"+vctObj.size());
		String s = "";
		for (int i = 0; i < vctObj.size(); i++) {
		System.out.println("I:"+i+"obj:"+vctObj.size());
			String strHotpotname = "",strLongitude = "",strLatitude = "",strCity = "",strTown = "",
			strHotpotType = "",strHotpotAddr = "",strArea = "",strTechonlog = "";
			String APname = "";
			String strhpid = "";
			Regional obj1 = vctObj.get(i);  //获取一条记录集
			
			strHotpotname = Format.forbidNull(obj1.getStrHotpotname());//获取热点名
			strLongitude = Format.forbidNull(obj1.getStrLongitude());//获取热点经度
			strLatitude = Format.forbidNull(obj1.getStrLatitude());//获取热点纬度
			strCity = Format.forbidNull(obj1.getStrCity());//获取热点所在地市
			strTown = Format.forbidNull(obj1.getStrTown());//获取热点所在区县
			strHotpotType = Format.forbidNull(obj1.getStrHotpotType());//获取热点类型
			strHotpotAddr = Format.forbidNull(obj1.getStrHotpotAddr());//获取热点地址
			strArea = Format.forbidNull(obj1.getStrArea());//获取热点覆盖区域
			strTechonlog = Format.forbidNull(obj1.getStrTechonlog());//获取热点覆盖技术
			strhpid = Format.forbidNull(obj1.getStrhpid());
			
			//获取每个热点已测的AP
			String APname1 = "";
			String where = " and strhotspot='" + strhpid + "'";
			List<String> list = obj.returntestAP(where);
			//System.out.println("I:"+i+"已测AP个数："+list.size());
			for (int j=0;j<list.size();j++){
				APname1 = APname1 + list.get(j) + ",";
			}
			if(APname1.length()>0){
				APname = APname1.substring(0,APname1.length()-1);
			}
			
			%>
		 	lat = '<%=strLatitude%>';    
		 	lng = '<%=strLongitude%>';
			var point = new BMap.Point(lng, lat);//创建坐标点的位置
			var marker = new BMap.Marker(point,{icon:image2});//标记坐标点
			map.centerAndZoom(point, 5);
			markers.push(marker);
			map.addOverlay(marker);//显示图标
			(function(){
				//var index = i;
				markers[<%=i%>].addEventListener('click', function(){
				this.openInfoWindow(new BMap.InfoWindow('热点：'+'<%=strHotpotname%>'+'<br/>地市：'+'<%=strCity%>'+'<br/>区县：'+
				'<%=strTown%>'+'<br/>地址：'+'<%=strHotpotAddr%>'+'热点类型：'+'<%=strHotpotType%>'+'<br/>热点技术：'+
				'<%=strTechonlog%>'+'<br/>覆盖范围：'+'<%=strArea%>'+'<br/>已测试的AP：'+'<%=APname ==null?"":APname%>'));   
				//弹出窗口显示热点相关信息
				}); 
			})();
			<%
		 	}
			}%>
	}
	</script>
	

  </head>
  
  <body onload="init(); show();  ">
	<div id="allmap" ></div>
  </body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>
